get out while the getting is good
Leave while one can or has the chance to, as in
He just had a good offer from a rival firm and decided to get out while the getting is good
. This colloquial phrase uses
get out
in the sense of “escape” or “depart.”